package com.jn.mvvm2.repository;

import com.jn.mvvm2.entity.HanZi;
import com.jn.mvvm2.http.GlobalRetrofitClient;
import com.jn.mvvm2.service.HanZiService;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class HanZiRepository {
    private HanZiService mHanZiService;

    public HanZiRepository() {
        mHanZiService = GlobalRetrofitClient.getInstance().create(HanZiService.class);
    }

    public Observable<HanZi> getData(String word) {
        return mHanZiService.getData(word)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}
